/*
 * pwm.c
 *
 *  Created on: Oct 14, 2010
 *      Author: ra
 */

#include "../include/pwm.h"

void init_PWM_timer() {

	//TIMER1 - Uses OCR1A & OCR1B for duty length. Fixed frequency : 50 Hz.

	TCCR1A |= ((1 << COM1A1) | (1 << COM1B1));
	ICR1 = 10000; //frequency division
	DDRB |= 6; //Enable ausgangs
	TCCR1B |= (1 << CS11) | (1 << WGM13); //

}

void pwm1_duty(unsigned int duty) {
	OCR1A = duty;
}
void pwm2_duty(unsigned int duty) {
	OCR1B = duty;
}
